/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package net.tygzs.minerpg.CommandExecutor.MineItem;

import net.tygzs.minerpg.Configuration.Item.RPGItem;
import net.tygzs.minerpg.Main;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;

/**
 *
 * @author thtTNT
 */
public class Command_Create
{
    
    public static void execut(CommandSender sender, String name)
    {
        RPGItem result = Main.getPluginConfig().CreateItem(name);
        if (result == null)
        {
            Main.getPluginConfig().getItem(name).setDamage(1);
            Main.getPluginConfig().getItem(name).setDisPlayName(name);
            Main.getPluginConfig().getItem(name).setDisPlayID(Material.WOOD_SWORD.getId());
            Main.getPluginConfig().getItem(name).setMaxDur(Material.WOOD_SWORD.getMaxDurability());
            Main.getPluginConfig().getItem(name).setDur(Material.WOOD_SWORD.getMaxDurability());
            Main.getPluginConfig().getItem(name).setType(RPGItem.RPGItemType.Normal);
            Main.getPluginConfig().getItem(name).setDisPlayDur(Short.parseShort("0"));
            sender.sendMessage(ChatColor.GREEN + "创建成功");
            return;
        }
        sender.sendMessage(ChatColor.RED + "相同名称的物品已经存在了");
    }
    
}
